package com.pisces.core;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 演示结果
 * 
 * @author lingxin
 *
 */
public class Result implements Serializable {

	private static final long serialVersionUID = 1L;
	
	public static final int CODE_SUCCEED = 0;
	public static final int CODE_FAILURE = 1;
	
	public static final String MESSAGE_UNKNOWN_EXCEPTION = "未知错误，请联系客服处理";

	private boolean success;
	private int code;
	private String message;
	private Map<String, Object> data;
	
	public Result() {
		this.success = true;
		this.message = "";
		this.code = CODE_SUCCEED;
		this.data = new HashMap<>();
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Map<String, Object> getData() {
		return data;
	}

	public void put(String key, Object value){
		this.data.put(key, value);
	}

	public void put(Map<String, Object> data){
		this.data.putAll(data);
	}
}
